﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace BackupRestoreSoftwares.FormChild
{
	public partial class m_Photoshop : UserControl
	{
		public m_Photoshop()
		{
			InitializeComponent();
		}

        string Roaming_path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString();
        string Local_path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).ToString();
        string Common_path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData).ToString();
        string Program_32 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles).ToString();
        string Program_64 = Path.GetPathRoot(Environment.SystemDirectory).ToString() + "Program Files";
        string App_path = Application.StartupPath.ToString();
        bool Is64 = Environment.Is64BitOperatingSystem;

        #region Rar - Compress - Extract
        private void CompressRAR(string rar_file, string path_file)
        {
            // - \" Thêm vào một dấu nháy kép ("")
            ProcessStartInfo ps = new ProcessStartInfo();
            ps.FileName = @"Rar.exe";
            ps.Arguments = "a -r -ep1 \"" + rar_file + "\" \"" + path_file + "\"";
            //ps.Arguments = "a -r -ep1 \"" + rar_file + "\" \"" + source + "\" -mx=9";
            //               1              2                       3               4
            ps.WindowStyle = ProcessWindowStyle.Hidden;
            Process proc = Process.Start(ps);
            proc.WaitForExit();
        }

        private void ExtractRAR(string rar_file, string path_file)
        {
            ProcessStartInfo ps = new ProcessStartInfo();
            ps.FileName = @"Rar.exe";
            ps.Arguments = "x -y \"" + rar_file + "\" \"" + path_file + "\"";
            ps.WindowStyle = ProcessWindowStyle.Hidden;
            Process proc = Process.Start(ps);
            proc.WaitForExit();
        }
        #endregion

        private void m_Photoshop_Load(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP");
            }
        }

        private void btn_bk_pts7_Click(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP\Photoshop") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP\Photoshop");
            }
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Photoshop 7.0\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTS7.rar";
                    string path_file = Roaming_path + @"\Adobe\Photoshop\7.0\";
                    CompressRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Backup completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop 7 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }

        }

        private void btn_res_pts7_Click(object sender, EventArgs e)
        {
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Photoshop 7.0\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTS7.rar";
                    string path_file = Roaming_path + @"\Adobe\Photoshop\7.0\";
                    ExtractRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Restore completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop 7 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }
        }

        private void btn_bk_pts8_Click(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP\Photoshop") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP\Photoshop");
            }
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Photoshop cs\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTS8.rar";
                    string path_file = Roaming_path + @"\Adobe\Photoshop\8.0\";
                    CompressRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Backup completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop 8 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }

        }

        private void btn_res_pts8_Click(object sender, EventArgs e)
        {
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Photoshop cs\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTS8.rar";
                    string path_file = Roaming_path + @"\Adobe\Photoshop\8.0\";
                    ExtractRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Restore completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop 8 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }
        }

        private void btn_bk_pts9_Click(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP\Photoshop") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP\Photoshop");
            }
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Adobe Photoshop CS2\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTS9.rar";
                    string path_file = Roaming_path + @"\Adobe\Photoshop\9.0\";
                    CompressRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Backup completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop 9 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }

        }

        private void btn_res_pts9_Click(object sender, EventArgs e)
        {
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Adobe Photoshop CS2\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTS9.rar";
                    string path_file = Roaming_path + @"\Adobe\Photoshop\9.0\";
                    ExtractRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Restore completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop 9 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }
        }

        private void btn_bk_ptscs3_Click(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP\Photoshop") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP\Photoshop");
            }
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Adobe Photoshop CS3\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS3.rar";
                    string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS3\Adobe Photoshop CS3 Settings\";
                    CompressRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Backup completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop CS 3 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }

        }

        private void btn_res_cs3_Click(object sender, EventArgs e)
        {
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Adobe Photoshop CS3\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS3.rar";
                    string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS3\Adobe Photoshop CS3 Settings\";
                    ExtractRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Restore completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop CS 3 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }
        }

        private void btn_bk_cs4_Click(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP\Photoshop") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP\Photoshop");
            }
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Photoshop cs4\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS4.rar";
                    string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS4\Adobe Photoshop CS4 Settings\";
                    CompressRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Backup completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop CS 4 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }

        }

        private void btn_res_cs4_Click(object sender, EventArgs e)
        {
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Adobe\Photoshop cs4\Photoshop.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "photoshop")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS4.rar";
                    string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS4\Adobe Photoshop CS4 Settings\";
                    ExtractRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Restore completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Adobe Photoshop CS 4 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }
        }

        private void btn_bk_cs5_Click(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP\Photoshop") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP\Photoshop");
            }
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                if (Is64 == true)
                {
                    string chkfile_64 = Program_64 + @"\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe";
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop cs5\Photoshop.exe";
                    if (File.Exists(chkfile_64) || File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS5.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS5\Adobe Photoshop CS5 Settings\";
                        CompressRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Backup completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CS5 don't install!", "Error");
                    }
                }
                else
                {
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop cs5\Photoshop.exe";
                    if (File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS5.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS5\Adobe Photoshop CS5 Settings\";
                        CompressRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Backup completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CS5 don't install!", "Error");
                    }
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }

        }

        private void btn_res_cs5_Click(object sender, EventArgs e)
        {
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                if (Is64 == true)
                {
                    string chkfile_64 = Program_64 + @"\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe";
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop cs5\Photoshop.exe";
                    if (File.Exists(chkfile_64) || File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS5.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS5\Adobe Photoshop CS5 Settings\";
                        ExtractRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Restore completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CS5 don't install!", "Error");
                    }
                }
                else
                {
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop cs5\Photoshop.exe";
                    if (File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS5.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS5\Adobe Photoshop CS5 Settings\";
                        ExtractRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Restore completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CS5 don't install!", "Error");
                    }
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }
        }

        private void btn_bk_cs6_Click(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP\Photoshop") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP\Photoshop");
            }
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                if (Is64 == true)
                {
                    string chkfile_64 = Program_64 + @"\Adobe\Adobe Photoshop CS6 (64 Bit)\Photoshop.exe";
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop CS6\Photoshop.exe";
                    if (File.Exists(chkfile_64) || File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS6.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS6\Adobe Photoshop CS6 Settings\";
                        CompressRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Backup completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CS6 don't install!", "Error");
                    }
                }
                else
                {
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop CS6\Photoshop.exe";
                    if (File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS6.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS6\Adobe Photoshop CS6 Settings\";
                        CompressRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Backup completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CS6 don't install!", "Error");
                    }
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }

        }

        private void btn_res_cs6_Click(object sender, EventArgs e)
        {
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                if (Is64 == true)
                {
                    string chkfile_64 = Program_64 + @"\Adobe\Adobe Photoshop CS6 (64 Bit)\Photoshop.exe";
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop CS6\Photoshop.exe";
                    if (File.Exists(chkfile_64) || File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS6.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS6\Adobe Photoshop CS6 Settings\";
                        ExtractRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Restore completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CS6 don't install!", "Error");
                    }
                }
                else
                {
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop CS6\Photoshop.exe";
                    if (File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCS6.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CS6\Adobe Photoshop CS6 Settings\";
                        ExtractRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Restore completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CS6 don't install!", "Error");
                    }
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }
        }

        private void btn_bk_ptscc_Click(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP\Photoshop") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP\Photoshop");
            }
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                if (Is64 == true)
                {
                    string chkfile_64 = Program_64 + @"\Adobe\Adobe Photoshop CC (64 Bit)\Photoshop.exe";
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop CC\Photoshop.exe";
                    if (File.Exists(chkfile_64) || File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCC.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CC\Adobe Photoshop CC Settings\";
                        CompressRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Backup completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CC don't install!", "Error");
                    }
                }
                else
                {
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop CC\Photoshop.exe";
                    if (File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCC.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CC\Adobe Photoshop CC Settings\";
                        CompressRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Backup completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CC don't install!", "Error");
                    }
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }

        }

        private void btn_res_ptscc_Click(object sender, EventArgs e)
        {
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                if (Is64 == true)
                {
                    string chkfile_64 = Program_64 + @"\Adobe\Adobe Photoshop CC (64 Bit)\Photoshop.exe";
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop CC\Photoshop.exe";
                    if (File.Exists(chkfile_64) || File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCC.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CC\Adobe Photoshop CC Settings\";
                        ExtractRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Restore completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CC don't install!", "Error");
                    }
                }
                else
                {
                    string chkfile_32 = Program_32 + @"\Adobe\Photoshop CC\Photoshop.exe";
                    if (File.Exists(chkfile_32))
                    {
                        foreach (Process app in Process.GetProcesses())
                            if (app.ProcessName == "photoshop")
                                app.Kill();
                        string rar_file = App_path + @"\DBBACKUP\Photoshop\PTSCC.rar";
                        string path_file = Roaming_path + @"\Adobe\Adobe Photoshop CC\Adobe Photoshop CC Settings\";
                        ExtractRAR(rar_file, path_file);

                        t.Abort();
                        MessageBox.Show("Restore completed!", "Finish");
                    }
                    else
                    {
                        t.Abort();
                        MessageBox.Show("Adobe Photoshop CC don't install!", "Error");
                    }
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }
        }

        private void btn_bk_neat6_Click(object sender, EventArgs e)
        {
            if (File.Exists(App_path + @"\DBBACKUP\Neatimage") != true)
            {
                Directory.CreateDirectory(App_path + @"\DBBACKUP\Neatimage");
            }
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Neat Image\NeatImage.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "NeatImage")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Neatimage\Neat.rar";
                    string path_file = Roaming_path + @"\Neat Image\PRESETS\";
                    CompressRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Backup completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Neatimage 6 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }

        }

        private void btn_res_neat6_Click(object sender, EventArgs e)
        {
            try
            {
                Thread t = new Thread(new ThreadStart(frmMain.waitscreen));
                t.Start();

                string chkfile_32 = Program_32 + @"\Neat Image\NeatImage.exe";
                if (File.Exists(chkfile_32))
                {
                    foreach (Process app in Process.GetProcesses())
                        if (app.ProcessName == "NeatImage")
                            app.Kill();
                    string rar_file = App_path + @"\DBBACKUP\Neatimage\Neat.rar";
                    string path_file = Roaming_path + @"\Neat Image\PRESETS\";
                    ExtractRAR(rar_file, path_file);

                    t.Abort();
                    MessageBox.Show("Restore completed!", "Finish");
                }
                else
                {
                    t.Abort();
                    MessageBox.Show("Neatimage 6 don't install!", "Error");
                }
            }
            catch
            {
                MessageBox.Show("Error! Please contact: caiwindao@outlook.com", "Error");
            }
        }
    }
}
